#include "2DTexture.h"
#include "Core\Core.h"
#include "RenderManager.h"



C2DTexture::C2DTexture()
: CTexture(), m_Texture(NULL) 
{}

C2DTexture::~C2DTexture()
{
	Unload();
}


bool C2DTexture::LoadFile()
{
	return !FAILED( D3DXCreateTextureFromFile(CORE->GetRenderManager()->GetDevice(), m_FileName.c_str(), &m_Texture) );
}


void C2DTexture::Unload()
{
	CHECKED_RELEASE(m_Texture);
}

void C2DTexture::Activate(size_t StageId)
{
	CORE->GetRenderManager()->GetDevice()->SetTexture(StageId, m_Texture);
}